
# 给定HuffMan树每层的叶子节点数，
# 和HuffMan树的层序遍历结果
# 要求重构HuffMan树

def LenEle2Huff(len_list, el_list):
    ans = []
    
    
    return ans

def IsLegalLenEleList(len_list, el_list):
    len_ll = len(len_list)
    if len_ll != 15:
        print("Not a Huff Length List")
        return False
    
    tot = 0
    for l in len_list:
        tot += l
    len_el = len(el_list)
    if tot != len_el:
        print("Element number not equal to  len list")
        return False
    return True

def DumpLenEleList(len_list, el_list):
    if IsLegalLenEleList(len_list, el_list) == False:
        return
    
    cnt = 0
    for i in range(1, 16):
        len_num = len_list[i - 1]
        
        if len_num != 0:
            
            print("size %d:"%(i),end=' ')
            for j in range(len_num):
                if j != 0:
                    print(",",end=' ')
                print(el_list[cnt],end=' ')
                cnt += 1
            print("")
        
    
    
    




if __name__ == "__main__":
    len_list=[ 0,2,3,1,0,
               0,0,0,0,0,
               0,0,0,0,0]
    el_list=['a','b','c','d','e','f']
    DumpLenEleList(len_list, el_list)